<?php
// $Id$
/**
 * @file
 * Field handler to provide simple renderer that allows using a themed user link
 */
class mewdkp_handler_field_content_player extends content_handler_field {
  function render_link($data, $values) {
		static $class = array();
		if (empty($class)) {
			$class = variable_get('mewdkp_lookup_class', array());
		}
		
    $value = _mewdkp_styles_get_player_class($values->{$this->aliases['field_mewdkp_player_nid']});		
    $value = strtolower(str_replace(' ', '', $class[$value]));
    $prefix = $value ? '<span class="'. $value .'">' : '';
    $suffix = $value ? '</span>' : '';

    if (!empty($this->options['link_to_node'])) {
      return $prefix . l($data, "node/" . $values->{$this->aliases['nid']}, array('html' => TRUE)) . $suffix;
    }
    else {
      return $prefix . $data . $suffix;
    }
  }
}